#pragma once

class DynamicObject
{
protected:
	double time = 0;
	double x, y;

public:
	DynamicObject(double x, double y) : x(x), y(y) {}
	virtual ~DynamicObject() = default;

	virtual void update(double dtime) = 0;
	virtual void draw(Graphics * graphics) = 0;
};

class LevelCircle :public DynamicObject
{
private:
	double rotatespeed = 500;
	Image * image;
	int width, height;
	double angle = 0;

public:
	LevelCircle(const std::wstring & picname, double x, double y, int rotatespeed = 500);
	~LevelCircle() = default;

	void update(double dtime) override;
	void draw(Graphics * graphics) override;
	void moveto(double x, double y);
};

class EndPoint :public DynamicObject
{
private:
	int width, height;
	Image * image;
	double angle = 0;
	int rotatespeed;

public:
	EndPoint(const std::wstring & picname, double x, double y, int rotatespeed = 500);
	~EndPoint() = default;

	void update(double dtime) override;
	void draw(Graphics * graphics) override;
	bool collide(const Rect & rc);
};

//class Collection :public DynamicObject
//{
//private:
//	int width, height;
//	Image * image;
//	double angle = 0;
//	int rotatespeed;
//
//public:
//	Collection(const std::wstring & picname, double x, double y, int rotatespeed = 700);
//	~Collection() = default;
//
//	void update(double dtime) override;
//	void draw(Graphics * graphics) override;
//	bool collide(const Rect & rc);
//};

class CollectionMgr
{
private:
	CollectionMgr() = default;
	~CollectionMgr();

	std::vector<EndPoint *> collects;
	static int count;

public:
	static CollectionMgr * getInstance();
	static int getCount();

	void update(double dtime);
	void draw(Graphics * graphics);
	void create(const std::wstring & picname, double x, double y, int rotatespeed = 700);
	void clear();
};